-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Implement unstable trait impl #140399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Implement unstable trait impl #140399
Conversation
d01f12a
to
9e139e1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
486d3d3
to
02f780f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
567ec89
to
80fd239
Compare
☔ The latest upstream changes (presumably #142299) made this pull request unmergeable. Please resolve the merge conflicts. |
850e3e1
to
27d9e21
Compare
dc8f28f
to
637b820
Compare
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (93970f9): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -4.9%, secondary 2.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.2%, secondary 3.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 463.69s -> 465.733s (0.44%) |
The only difference between the latest commit and the one being used for perf is comment. Hi @compiler-errors, I think you might be interested to see the perf result. |
☔ The latest upstream changes (presumably #143934) made this pull request unmergeable. Please resolve the merge conflicts. |
637b820
to
e331de1
Compare
[Perf] Remove call to hir_attrs in predicates_of <!-- homu-ignore:start --> <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> --> <!-- homu-ignore:end --> Test how much regression we still have if we remove the call to ``hir_attrs`` in ``predicates_of`` for #140399 r? ghost
looks like the cost is from just the new While I think changing Unless you want to try something to reduce the perf impact, r=me |
@bors r=lcnr rollup=never I would really like to get this perf back but also supporting stability of |
@bors r=lcnr,BoxyUwU |
💡 This pull request was already approved, no need to approve it again.
|
I am happy to send a follow-up PR to try more stuff to claw back the perf Thanks for all the reviews ❤️ |
This PR allows marking impls of stable trait with stable type as unstable.
Approach
In std/core, an impl can be marked as unstable by annotating it with
#[unstable_feature_bound(feat_name)]
. This will add aClauseKind::Unstable_Feature(feat_name)
to the list of predicates inpredicates_of
.When an unstable impl's function is called, we will first iterate through all the goals in
param_env
to check if there is anyClauseKind::UnstableFeature(feat_name)
inparam_env
.The existence of
ClauseKind::Unstable_Feature(feat_name)
inparam_env
means an#[unstable_feature_bound(feat_name)]
is present at the call site of the function, so we allow the check to succeed in this case.If
ClauseKind::UnstableFeature(feat_name)
does not exist inparam_env
, we will still allow the check to succeed for either of the cases below:#[feature(feat_name)]
outside of std / core.For the rest of the case, it will fail with ambiguity.
Limitation
In this PR, we do not support:
#[unstable_feature_bound]
within stable APIs#[unstable_feature_bound]
#[unstable_feature_bound]
on items other than free function and implAcknowledgement
The design and mentoring are done by @BoxyUwU